﻿using FileData.Currency;
using FileData.DataUtils.ViewUtils;
using FileData.Utils.Currency.FileUtils;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace FileData.ViewManger
{
    public partial class DataControl : UserControl
    {
        public DataControl()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            new DataTool().RepFileContentWithFloder(textBox1.Text, textBox2.Text, new FloderHelper().SelectFloder());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            new DataTool().RepFileContent(textBox1.Text, textBox2.Text, new FileHelper().SelectFile());
        }

        private void button3_Click(object sender, EventArgs e)
        {
            new DataTool().RestoreFileName(new FileHelper().SelectFile());
        }

        private void button4_Click(object sender, EventArgs e)
        {
            new DataTool().RestoreFloder(new FloderHelper().SelectFloder());
        }

        private void button5_Click(object sender, EventArgs e)
        {
            new DataTool().RepFileName(new FileHelper().SelectFile(), textBox3.Text, textBox4.Text);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            new DataTool().RepFileNameWithFloder(new FloderHelper().SelectFloder(), textBox3.Text, textBox4.Text);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            new DataTool().AddContentWithFloder(new FloderHelper().SelectFloder(), richTextBox1.Text);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            new DataTool().AddContentWithFile(new FileHelper().SelectFile(), new DataTool().CreateVirtualCloudDirverContent(richTextBox1.Text));
        }

        private string RegFile = "";

        private void button11_Click(object sender, EventArgs e)
        {
            RegFile = new FileHelper().SelectFile();
            label5.Text = string.Format("当前选择文件：{0}", new FileNameHelper().GetFileNameWithoutExtension(RegFile));
        }

        private void button9_Click(object sender, EventArgs e)
        {
            List<string> TempList = FileHelper.ReadAllLine(RegFile);
            new DataTool().RepFileName(new FileHelper().SelectFile(), TempList, textBox4.Text);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            List<string> TempList = FileHelper.ReadAllLine(RegFile);
            new DataTool().RepFileNameWithFloder(new FloderHelper().SelectFloder(), TempList, textBox4.Text);
        }

        private void button13_Click(object sender, EventArgs e)
        {
            new FileEncrypt().FileReverseBatch(new FloderHelper().SelectFloder());
        }

        private void button12_Click(object sender, EventArgs e)
        {
            new FileEncrypt().FileReverse(new FileHelper().SelectFile());
        }

        private void button14_Click(object sender, EventArgs e)
        {
            new FileEncrypt().EncryptBase64(new FileHelper().SelectFile());
        }

        private void button15_Click(object sender, EventArgs e)
        {
            new FileEncrypt().EncryptBase64Bath(new FloderHelper().SelectFloder());
        }

        private void button16_Click(object sender, EventArgs e)
        {
            new FileEncrypt().DecryptBase64(new FileHelper().SelectFile());
        }

        private void button17_Click(object sender, EventArgs e)
        {
            new FileEncrypt().DecryptBase64Bath(new FloderHelper().SelectFloder());
        }

        private void button20_Click(object sender, EventArgs e)
        {
            new BaiduDriverTool().Floder(new FloderHelper().SelectFloder());
        }

        private void button18_Click(object sender, EventArgs e)
        {
            new BaiduDriverTool().SingleFile(new FileHelper().SelectFile());
        }

        private void button19_Click(object sender, EventArgs e)
        {
            new DataTool().AddRule(textBox5.Text, textBox7.Text, textBox8.Text);
            textBox5.Text = "";
            textBox7.Text = "";
        }

        private void button21_Click(object sender, EventArgs e)
        {
            new HtmlClear().ClearSingle(new FileHelper().SelectFile());
        }

        private void button22_Click(object sender, EventArgs e)
        {
            new HtmlClear().ClearFloder(new FloderHelper().SelectFloder());
        }

        private void button23_Click(object sender, EventArgs e)
        {
            RegFile = new FileHelper().SelectFile();
            label10.Text = string.Format("当前选择文件：{0}", new FileNameHelper().GetFileNameWithoutExtension(RegFile));
        }

        private void button24_Click(object sender, EventArgs e)
        {
            new DataTool().BatchRegFile(RegFile, new FileHelper().SelectFile());
        }

        private void button25_Click(object sender, EventArgs e)
        {
            new DataTool().BatchRegFloder(RegFile, new FloderHelper().SelectFloder());
        }
    }
}